package com.ibm.ibank.demo.mybatis.service;

import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronizationManager;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Service
@Primary
public class UserServiceImpl implements UserService {

	@Override
	@Transactional(readOnly = true)
	public String hello(String user) {
		boolean readonly = TransactionSynchronizationManager.isCurrentTransactionReadOnly();
		log.info("readonly: {}", readonly);
		return "Hello " + user;
	}

}
